home *** CD-ROM | disk | FTP | other *** search
-
- //
- // Description:
- // Window callback example. Defines a new window class which uses callback function
- // to report window events to the user.
- //
- // Super class:
- // oops/r3window.js
- //
- // Constructor:
- // obj = new myCallbackWindow(tag list);
- //
- //
-
- include("oops/r3window.js");
- include("oops/r3packer.js");
- include("oops/r3text.js");
-
- // function for handling window events
-
- function myCallbackTestHook(win, method, val)
- {
- if(method == R3WM_CLOSEWINDOW) {
- this.info.SetText("Closewindow");
- }
- else if(method == R3WM_NEWSIZE) {
- this.info.SetText("Newsize");
- }
- else if(method == R3WM_MOUSEMOVE) {
- this.info.SetText("MouseMove");
- }
- else if(method == R3WM_LMBDOWN) {
- this.info.SetText("Left mouse button down");
- }
- else if(method == R3WM_LMBUP) {
- this.info.SetText("Left mouse button up");
- }
- else {
- this.info.SetText("Event Id: " + method);
- }
- return 1;
- }
-
- // constructor
-
- function myCallbackTestWin()
- {
- // call super class
- if(arguments.length == 0)
- return;
- this.base = r3Window;
- this.base(R3WA_ReportNewSize, TRUE,
- R3WA_ReportCloseWindow, TRUE,
- R3WA_Title, "My Callback test",
- R3RA_Hook, myCallbackTestHook,
- arguments);
-
- // create a info field
- this.info = new r3Text(R3WGA_Parent, this,
- R3GA_Text, "Event");
-
- // tell the hook function where to find the info field
- myCallbackTestHook.info = this.info;
-
- // use packer to manage the info field
- this.packer = new r3Packer(R3PA_Orientation, R3PAOF_VERTICAL);
- this.packer.ADD(R3PAPF_FILLX, 0, this.info);
- this.SetGmanager(this.packer);
- }
-
- myCallbackTestWin.prototype=new r3Window;
-